"use strict";

module.exports = (app) => {
  const { STRING, INTEGER, DATE } = app.Sequelize;

  const Product = app.model.define("product", {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true,
    },
    name: {
      type: STRING(64),
      allowNull: false,
      comment: "商品名",
      unique: 'column',
    },
    price: {
      type: INTEGER,
      allowNull: false,
      comment: "价格",
    },
    desc: {
      type: STRING(64),
      allowNull: true,
      comment: "描述",
    },
    create_user_id:{
      type: INTEGER,
      allowNull:false,
      comment:"创建人"
    }
  });

  Product.sync({ alter: true });

  return Product;
};
